//Set the number of days before your cookie should expire
var ExpireDays = 90;
var qstr = 0;
//Do not change anything below this line
qstr = document.location.search;
qstr = qstr.substring(1,qstr.length);

function SetCookie(cookieName,cookieValue,nDays)
{
	var today = new Date();
	var expire = new Date();
	if (nDays==null || nDays==0) nDays=1;
	expire.setTime(today.getTime() + 3600000*24*nDays);
	document.cookie = cookieName+"="+escape(cookieValue)+ ";expires="+expire.toGMTString();
}

//look at length of qstr, if > 0 then there is a query string
if(qstr.length > 0)
{
	//parse out url params into pairs (e=fake@email.com,j=123)
	var nvPairs = qstr.split("&");
	//now for each pair get out the param name and value ex. e=fake@email.com
	for (i = 0; i < nvPairs.length; i++)
	{
		var nvPair = nvPairs[i].split("=");
		var nvName = nvPair[0];
		var nvValue = nvPair[1];
		//debugging
		//alert(nvName);
		//alert(nvValue);
        //?j=2541269&xte=dguzman@ticketsnow.com&xtl=404187_HTML&u=24413805&mid=44368
		switch(nvName)//look at param name
		{
			case "xte":
				SetCookie("EmailAddr",nvValue,ExpireDays);
				break;
			case "j":
				SetCookie("JobID",nvValue,ExpireDays);
				break;
			case "jb":
				SetCookie("BatchID",nvValue,ExpireDays);
				break;
			case "xtl":
				SetCookie("ListID",nvValue,ExpireDays);
				break;
			case "u":
				SetCookie("UrlID",nvValue,ExpireDays);
				break;
			case "mid":
				SetCookie("MemberID",nvValue,ExpireDays);
				break;
			default:
				break;
		}

	}
}